<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="恢复SQL Server数据库">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="sql-0049.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect 备份一体机 1.5.0-1.6.0 帮助中心">
<meta name="DC.Publisher" content="20240320">
<meta name="prodname" content="csbs">
<meta name="documenttype" content="usermanual">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="sql-0052">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>恢复SQL Server数据库</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="sql-0052"></a><a name="sql-0052"></a>

<h1 class="topictitle1">恢复SQL Server数据库</h1>
<div><p>当需要对已备份的数据库进行恢复时，可以参考本节使用副本恢复数据库至原机或异机。</p>
<div class="section"><h4 class="sectiontitle">前提条件</h4><ul><li>在进行异机恢复时，请确保目标主机上存在数据库实例。</li><li id="sql-0052__zh-cn_topic_0000001731610773_li17731230145317">恢复前请确保恢复目标位置的数据目录剩余空间大于恢复副本缩减前大小，否则恢复将失败。</li></ul>
</div>
<div class="section"><h4 class="sectiontitle">操作步骤</h4><ol><li><span>选择<span class="uicontrol" id="sql-0052__zh-cn_topic_0000001839142377_uicontrol17392202272717">“<span id="sql-0052__zh-cn_topic_0000001839142377_text1939210224272">数据利用</span> &gt; <span id="sql-0052__zh-cn_topic_0000001839142377_text439314220278">副本数据</span> &gt; <span id="sql-0052__zh-cn_topic_0000001839142377_text14652358184918">数据库</span> &gt; <span id="sql-0052__zh-cn_topic_0000001839142377_text6385151219337">SQL Server</span>”</span>。</span></li><li><span>您可以以数据库资源维度或以副本维度查找副本，本节以资源维度为例进行说明。</span><p><p>在<span class="uicontrol">“<span>资源</span>”</span>页签，根据资源名称查找到需要恢复的资源，并单击资源名称。</p>
</p></li><li><span>选择副本恢复的资源。</span></li><li><span>指定副本或指定时间点进行恢复。</span><p><ul><li>指定副本恢复<ol type="a"><li>依次选择年、月、天找到副本。<p>当时间上显示<span><img src="zh-cn_image_0000002015617062.png"></span>，即表示该月、该天存在副本。</p>
</li><li>在副本数据页面单击<span><img src="zh-cn_image_0000002051616649.png"></span>，单击需要恢复的副本所在行的<span class="menucascade">“<span class="uicontrol"><span>更多</span></span> &gt; <span class="uicontrol"> <span>恢复</span></span>”</span>。</li></ol>
</li><li>指定时间点恢复<ol type="a"><li>依次选择年、月、天找到副本。<p>当时间上显示<span><img src="zh-cn_image_0000002015458878.png"></span>，即表示该月、该天存在副本。</p>
</li><li>在副本数据页面单击<span><img src="zh-cn_image_0000002051497613.png"></span>，在时间轴上选择蓝色覆盖区域的副本，单击<span class="menucascade">“<span class="uicontrol"><span>更多</span></span> &gt; <span class="uicontrol"> <span>恢复</span></span>”</span>。</li></ol>
</li></ul>
</p></li><li><span>恢复SQL Server数据库相关参数说明如<a href="#sql-0052__table93951625101715">表1</a>所示</span><p>
<div class="tablenoborder"><a name="sql-0052__table93951625101715"></a><a name="table93951625101715"></a><table cellpadding="4" cellspacing="0" summary="" id="sql-0052__table93951625101715" frame="border" border="1" rules="all"><caption><b>表1 </b>恢复SQL Server数据库参数说明</caption><colgroup><col style="width:32.53%"><col style="width:67.47%"></colgroup><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="32.53%" id="mcps1.3.3.2.5.2.1.2.3.1.1"><p>参数</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="67.47%" id="mcps1.3.3.2.5.2.1.2.3.1.2"><p>说明</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p id="sql-0052__p1024024017317"><span id="sql-0052__text15471356412">恢复至</span></p>
</td>
<td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p id="sql-0052__p16496164110123">选择恢复至<span class="uicontrol" id="sql-0052__uicontrol84961241181211">“<span id="sql-0052__text19159183316300">原位置</span>”</span>或<span class="uicontrol" id="sql-0052__uicontrol12496341161217">“<span id="sql-0052__text17983138143120">新位置</span>”</span>。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p id="sql-0052__p653712813415"><span id="sql-0052__text105489481943">位置</span></p>
</td>
<td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p id="sql-0052__p16496184121216">当选择恢复至<span class="uicontrol" id="sql-0052__uicontrol5674181313310">“<span id="sql-0052__text48352563919">原位置</span>”</span>时，默认显示原位置。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p id="sql-0052__p1339520259174"><span id="sql-0052__text329817453610">目标主机/集群</span></p>
</td>
<td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>当选择恢复至<span class="uicontrol">“<span>新位置</span>”</span>时，选择原主机或异主机恢复。</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span>目标实例</span></p>
</td>
<td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p id="sql-0052__p6807933139">当选择恢复至<span class="uicontrol" id="sql-0052__uicontrol63818461965">“<span id="sql-0052__text625115598103">新位置</span>”</span>时，选择目标主机上的实例。</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><ul><li>当恢复的资源类型为“数据库”时展示该参数。</li><li>请确保目标实例不能存在同名数据库或同名可用性组。</li></ul>
</div></div>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span>目标路径</span></p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><p>仅1.5.0版本本支持设置该参数。</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>选择恢复至<span class="uicontrol">“<span>新位置</span>”</span>时展示该参数，将数据库文件恢复到目标主机的路径。</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><ul><li>当恢复的资源类型为“数据库”时展示该参数。</li><li><span style="color:#282B33;">请确保该目标路径盘符已存在且不是盘符根目录，数据库用户对该目标路径具有写权限。</span></li><li>请确保目标路径下不能存在同名数据库文件。</li></ul>
</div></div>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span>数据库重命名</span></p>
</td>
<td class="cellrowborder" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>开启后，可对恢复后的数据库重命名。</p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><ul><li>当恢复的资源类型为“数据库”时展示该参数。</li><li>当开启了数据库重命名且数据库恢复至原位置，恢复完成后，需选择数据库所属实例进行资源扫描（在“保护 &gt; 数据库 &gt; SQL Server &gt; 实例”页面，在实例所在行单击“更多 &gt; 资源扫描”。），并对该执行一次全量备份。</li></ul>
</div></div>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="32.53%" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span>恢复前执行脚本</span></p>
</td>
<td class="cellrowborder" rowspan="3" valign="top" width="67.47%" headers="mcps1.3.3.2.5.2.1.2.3.1.2 "><p>您可以根据实际需求，在恢复任务执行前、执行成功后、执行失败后，执行自定义脚本。</p>
<p><span>请输入脚本名称，脚本名称以</span><strong>.bat</strong><span>结尾。</span><span style="color:#282B33;">确保脚本已存放在数据库主机的“DataBackup\ProtectClient\ProtectClient-E\bin\thirdparty”目录，且登录数据库主机的用户（默认为root）对该脚本有可执行权限。</span></p>
<div class="note"><span class="notetitle"> 说明： </span><div class="notebody"><ul><li>当恢复的资源类型为“数据库”时展示该参数。</li><li>当配置了<span class="uicontrol">“<span>恢复成功执行脚本</span>”</span>时，即使该脚本执行失败，<span>OceanProtect备份一体机</span>上也会显示恢复任务的状态为<span class="uicontrol">“<span>成功</span>”</span>。请您留意任务详情中是否有后置脚本执行失败的相关提示，如有请及时修正脚本。</li></ul>
</div></div>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span>恢复成功执行脚本</span></p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.2.1.2.3.1.1 "><p><span>恢复失败执行脚本</span></p>
</td>
</tr>
</tbody>
</table>
</div>
</p></li><li><span>单击<span class="uicontrol">“确定”</span>。</span></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>父主题：</strong> <a href="sql-0049.html">恢复</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>